Set benefit increases to negative values in net revenue impact table#2672
Set benefit increases to negative values in net revenue impact table#2672v-lerie wants to merge 4 commits intoPolicyEngine:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
| ? impact.budget[item.budgetKey] | ||
| : item.formula(impact.budget), | ||
| item.budgetKey === "benefit_spending_impact" | ||
| ? -Math.abs(impact.budget[item.budgetKey]) |
There was a problem hiding this comment.
issue, blocking: I believe this only half-solves the problem
In cases where the government budget loses revenue (e.g., a new benefit program is introduced), the benefits row should be negative, but in cases where the government budget gains revenue (e.g., benefit cuts), it should be positive. This code will always make it positive.
| ? impact.budget[item.budgetKey] | ||
| : item.formula(impact.budget), | ||
| item.budgetKey === "benefit_spending_impact" | ||
| ? -Math.abs(impact.budget[item.budgetKey]) |
There was a problem hiding this comment.
issue, blocking: It's tough to read this nested conditional
Addressing my other comment, can you modify this to be more readable/CLEAN?
| } | ||
|
|
||
| if (budgetKey === "benefit_spending_impact") { | ||
| impact = -Math.abs(impact); |
There was a problem hiding this comment.
issue, blocking: Here, too budgetary impacts are always negative when they should be negative only sometimes
Description
Fixes #2601
Screenshots